﻿
<myframework:View x:Class="MyFramework.Shell.Views.ExceptionHandlingView"
                  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                  xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                  xmlns:myframework="https://myframework.codeplex.com/myframework/xaml/presentation"
                  Title="ExceptionHandlingView"
                  d:DesignHeight="400"
                  d:DesignWidth="600"
                  mc:Ignorable="d">
    <Window.Resources>
        <BooleanToVisibilityConverter x:Key="VisibilityOfBool" />
    </Window.Resources>
    <Grid Background="Gray">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <Image Grid.Row="0"
               Grid.Column="0"
               Width="32"
               Height="32"
               Margin="5"
               HorizontalAlignment="Center"
               VerticalAlignment="Top"
               SnapsToDevicePixels="True"
               Source="pack://application:,,,/MyFramework.Shell;component/Images/close.png"
               Stretch="UniformToFill"
               ToolTip="Error" />
        <TextBlock Grid.Row="0"
                   Grid.Column="1"
                   Margin="5"
                   VerticalAlignment="Center"
                   Text="{Binding ApplicationName,
                                  StringFormat={}{0} has stopped working}" />
        <TextBlock Grid.Row="1"
                   Grid.Column="1"
                   Margin="5"
                   Text="The application has stopped working unexpectedly." />
        <CheckBox Grid.Row="2"
                  Grid.Column="1"
                  Margin="5"
                  Content="Restart Application"
                  IsChecked="{Binding RestartApplication}" />
        <TextBlock Grid.Row="3"
                   Grid.Column="0"
                   Grid.ColumnSpan="2"
                   Margin="5"
                   Text="Further useful information to diagnose the exception (for example, the operation you were trying to do, the value you were trying to insert...)"
                   TextWrapping="WrapWithOverflow" />
        <TextBox Grid.Row="4"
                 Grid.Column="0"
                 Grid.ColumnSpan="2"
                 Height="80"
                 AcceptsReturn="True"
                 Text="{Binding UserMessage}"
                 TextWrapping="WrapWithOverflow" />
        <DockPanel Grid.Row="5"
                   Grid.ColumnSpan="2"
                   Margin="5"
                   LastChildFill="True">
            <Grid DockPanel.Dock="Top">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                    <ColumnDefinition Width="Auto" />
                </Grid.ColumnDefinitions>
                <CheckBox Grid.Column="0"
                          Grid.ColumnSpan="3"
                          VerticalAlignment="Center"
                          Content="More information on exception..."
                          DockPanel.Dock="Top"
                          IsChecked="{Binding MoreInformationVisibility}" />
                <Button Grid.Column="1"
                        Width="60"
                        Margin="5"
                        HorizontalAlignment="Right"
                        Command="{Binding SendCommand}"
                        Content="Send"
                        DockPanel.Dock="Top" />
                <Button Grid.Column="2"
                        Width="60"
                        Margin="5"
                        HorizontalAlignment="Right"
                        Command="{Binding CloseCommand}"
                        Content="Close"
                        DockPanel.Dock="Top" />
            </Grid>
            <ScrollViewer HorizontalScrollBarVisibility="Disabled">
                <TextBlock ScrollViewer.CanContentScroll="True"
                           ScrollViewer.VerticalScrollBarVisibility="Visible"
                           Text="{Binding MoreInformation}"
                           Visibility="{Binding MoreInformationVisibility,
                                                Converter={StaticResource VisibilityOfBool}}" />
            </ScrollViewer>
        </DockPanel>
    </Grid>
</myframework:View>
